


using System;
using System.Data;using THSERP.BusinessEntities;using THSERP.BaseProvider;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using THSLib;using THSERP.BaseProvider;

namespace THSERP.Modules.PriceList
{
    public class PriceListEntities : ERPModuleEntities
    {
        #region Declare Constant
        public readonly static String strARPriceListsObjectName = "ARPriceLists";

        public readonly static String strARPriceListDetailsObjectName = "ARPriceListDetails";
        #endregion
        
        #region Declare all entities variables
        private ARPriceListsInfo _aRPriceListsObject;
        private ARPriceListDetailsInfo _aRPriceListDetailsObject;
 
        public THSList<ARPriceListDetailsInfo> lstARPriceListDetails;
        #endregion

        #region Public Properties
        public ARPriceListsInfo ARPriceListsObject
        {
            get
            {
                return _aRPriceListsObject;
            }
            set
            {
                _aRPriceListsObject = value;
            }
        }
        public ARPriceListDetailsInfo aRPriceListDetailsObject
        {
            get
            {
                return _aRPriceListDetailsObject;
            }
            set
            {
                _aRPriceListDetailsObject = value;
            }
        }

        public THSList<ARPriceListDetailsInfo> ARPriceListDetailsList
        {
            get
            {
                return lstARPriceListDetails;
            }
            set
            {
                lstARPriceListDetails = value;
            }
        }      
       
        #endregion

        #region Constructor
        public PriceListEntities()
            : base()
        {
            _aRPriceListsObject = new ARPriceListsInfo();

            _aRPriceListDetailsObject = new ARPriceListDetailsInfo();

            lstARPriceListDetails = new THSList<ARPriceListDetailsInfo>();
        }

        #endregion

        #region Init Main Object,Module Objects functions
        public override void InitMainObject()
        {

            MainObject = ARPriceListsObject;
        }

        public override void InitModuleObjects()
        {
            ModuleObjects.Add("ARPriceListDetails", aRPriceListDetailsObject);
        }

        public override void InitModuleObjectList()
        {            
            lstARPriceListDetails = new THSList<ARPriceListDetailsInfo>();
            //lstARPriceListDetails.InitTHSList(this, THSUtil.GetTableNameFromBusinessObjectType(typeof(ARPriceListDetailsInfo)));
            lstARPriceListDetails.InitTHSList(this, "ARPriceLists", "ARPriceListDetails");
        }

        public override void InitGridControlInTHSList()
        {
            lstARPriceListDetails.InitTHSListGridControl();
        }

        public override void SetDefaultModuleObjectsList()
        {
            try
            {
                lstARPriceListDetails.SetDefaultListAndRefreshGridControl();

            }
            catch (Exception)
            {
                return;
            }
        }

        #endregion

        #region Invalidate Module Objects functions


        public override void InvalidateModuleObjects(int iObjectID)
        {
            ARPriceListDetailsList.Invalidate(iObjectID);
        }


        #endregion

        #region Save Module Objects functions

        public override void SaveModuleObjects()
        {
            ARPriceListDetailsList.SaveItemObjects(true);
        }

        #endregion


    }
}
